package cn.zs.supply.common.core.domain.result;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.ToString;
import scala.Int;

import java.io.Serializable;


@Data
@ToString
public class BaseResult implements Serializable {


    @JsonIgnore
    private String errcode;
    @JsonProperty("msg")
    private String errmsg;
    @JsonIgnore
    private Boolean success;

    private Integer code;

    public BaseResult() {

    }

    public Integer getCode() {
        if (this.code != null) {
            return code;
        } else if (this.errcode != null) {
            return Integer.parseInt(this.errcode);
        }
        return null;
    }

    public BaseResult(Boolean success, String errcode, String errmsg) {
        this.success = success;
        this.errcode = errcode;
        this.errmsg = errmsg;
    }

}
